package com.atguigu.gmall.search.vo;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.List;

/**
 * @Author zhaoshuo
 * @ClassName Goods
 * @Description
 */
@Document(indexName = "goods", replicas = 2, shards = 2)
@Data
public class Goods {
    @Id
    private Long skuId;

    @Field(type = FieldType.Keyword)
    private String defaultImage;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String title;

    @Field(type = FieldType.Double)
    private Double price;

    @Field(type = FieldType.Keyword)
    private String subtitle;

    @Field(type = FieldType.Boolean)
    private Boolean store = false;

    @Field(type = FieldType.Long)
    private Long sales = 0L;

    @Field(type = FieldType.Date, format = DateFormat.date)
    private Date createTime;

    @Field(type = FieldType.Long)
    private Long brandId;

    @Field(type = FieldType.Keyword)
    private String brandName;

    @Field(type = FieldType.Keyword)
    private String logo;

    @Field(type = FieldType.Long)
    private Long categoryId;

    @Field(type = FieldType.Keyword)
    private String categoryName;

    @Field(type = FieldType.Nested)
    List<SearchAttrValue> searchAttrValues;
}